import {timeUtil} from '../../util'
import {gpsStatus} from '../approval/refs/approve.data.gpsstatus'
import {orderDetailsData} from './orderDetails.vue.data'
import {methodsHelper} from './helper/orderDetails.vue.methods.helper'

const orderDetailsMethods = {
  /// 初始化
  initOrderDetails () {
    // 收起所有卡片 - 页面加载完成之后展开
    this.clickCollapseAllButton()

    // 初始化 - 路由参数校验
    if (methodsHelper.init.validatePageParams(this.$route, this.pageControl)) {
      // 保存页面参数
      methodsHelper.init.savePageParam(this.pageParams, this.$route)

      /// 设置页面控制变量
      // 操作类型 - 当前
      this.pageControl.current.operateType = this.pageControl.operateType[this.pageParams.operateType]
      // 初始化 - 当前操作相关设置
      methodsHelper.init.operateTypeRelateSettings(this.pageControl, this.cardConfig)

      // 操作人身份 - 当前
      this.pageControl.current.identity = this.pageControl.identity[this.pageParams.identity]
      // 初始化 - 当前身份相关设置
      methodsHelper.init.identityRelateSettings(this.pageControl)

      // 信审流程阶段 - 当前
      this.pageControl.current.approvalStep = this.pageControl.approveStep[this.pageParams.approvalStep]
      // 初始化 - 当前流程阶段相关设置
      methodsHelper.init.approvalStepRelateSettings(this.pageControl, this.apiUrl, this.cardConfig, this.pageTitle, this.pageParams)

      // 查询详细数据
      this.queryOrderDetail()

      // 展开所有card
      window.setTimeout(() => { this.clickCollapseAllButton() }, 1000)
    } else {
      this.$message.error({ duration: 0, message: 'URL参数异常，拒绝访问！', showClose: false })
    }
  },
  /// 初始化 - 调接口查询明细数据
  queryOrderDetail () {
    this.$http.get(this.apiUrl.base.queryOrderDetail, {params: {appCode: this.pageParams.appCode}}).then(response => {
      if (response && response.data.status === 0) {
        // 绑定数据
        this.pageData = response.data.data

        // todo thinking 下拉数据转换 - 下拉框绑定问题 - 返回的数字转成字符串

        // 设置页面控制变量
        // 车牌类型：0 是私牌，非0是公牌
        this.pageControl.current.isCompanyLicense = (this.pageData.orderBaseInfo.isCompanyLicense !== '0')
        // 是否已婚：1 已婚，0 未婚，2 离异，3 丧偶
        this.pageControl.current.isMarried = (this.pageData.orderProppserInfo.marriage === '1')
        // 是否有担保人：0 否，1 是
        this.pageControl.current.hasGuaranteeInfo = (this.pageData.orderProppserInfo.isAssure === '1')
        // 访问许可
        this.pageControl.accessAllowed = true

        // 如果是编辑页需要解密所有的脱敏数据
        if (this.pageControl.current.operateTypeModify) {
          // 申请人手机号码
          this.encryptionData(this.encryptionType.proposer.mobile, this.pageData.orderProppserInfo, this.encryptionType.proposer.eyeOwner)
          // 申请人证件号码
          this.encryptionData(this.encryptionType.proposer.idno, this.pageData.orderProppserInfo, this.encryptionType.proposer.eyeOwner)
          // 申请人紧急联系人手机号码
          this.encryptionData(this.encryptionType.eContactMobile, this.pageData.orderProppserInfo)
          // 申请人紧急联系人2手机号码
          this.encryptionData(this.encryptionType.eContactsMobile, this.pageData.orderProppserInfo)
          // 车辆识别代号
          this.encryptionData(this.encryptionType.carIdentify, this.pageData.orderCarInfo)
          // 二手车卖方身份证号
          this.encryptionData(this.encryptionType.carSaleIdno, this.pageData.orderCarInfo)
          // 担保人证件号码
          this.encryptionData(this.encryptionType.guarantee.idno, this.pageData.guaranteeInfo, this.encryptionType.guarantee.eyeOwner)
          // 担保人手机号码
          this.encryptionData(this.encryptionType.guarantee.mobile, this.pageData.guaranteeInfo, this.encryptionType.guarantee.eyeOwner)
          // 配偶手机号码
          this.encryptionData(this.encryptionType.relative.mobile, this.pageData.orderRelativeInfo, this.encryptionType.relative.eyeOwner)
          // 配偶证件号码
          this.encryptionData(this.encryptionType.relative.idno, this.pageData.orderRelativeInfo, this.encryptionType.relative.eyeOwner)
        }
      } else {
        this.$message.warning({ duration: 0, message: '遇到错误！响应信息：' + response.data.msg, showClose: false })
      }
    })
  },
  /// 页面控制 - 显示详细按钮
  clickShowDetailsButton () {
    this.cardConfig.detailButton.showDetails = !this.cardConfig.detailButton.showDetails
    this.cardConfig.detailButton.text.current = this.cardConfig.detailButton.showDetails ? this.cardConfig.detailButton.text.hide : this.cardConfig.detailButton.text.show
    this.cardConfig.collapseButton.flag = this.cardConfig.detailButton.showDetails
    this.clickCollapseAllButton()
  },
  /// 页面控制 - 折叠所有按钮
  clickCollapseAllButton () {
    this.cardConfig.collapseButton.flag = !this.cardConfig.collapseButton.flag
    this.cardConfig.collapseButton.text.current = this.cardConfig.collapseButton.flag ? this.cardConfig.collapseButton.text.hide : this.cardConfig.collapseButton.text.show
    for (var card in this.cardConfig) {
      if (this.cardConfig[card].visible !== undefined) {
        this.cardConfig[card].visible = this.cardConfig.collapseButton.flag
      }
    }
  },
  /// 页面控制 - 卡片标题点击事件：折叠/展开
  cardTitleClickHandler (card) {
    card.visible = !card.visible
    card.title.btnClass = card.visible ? orderDetailsData.cardConfig.btnClass.arrowUp : orderDetailsData.cardConfig.btnClass.arrowDown
  },
  /// 页面控制 - 解密回显
  encryptionData (encryptionType, dataObject, eyeOwner) {
    // 判业务数据不为空的时候才去解密
    if (dataObject[encryptionType] && dataObject[encryptionType] !== null) {
      let encryptionParam = {appCode: this.pageParams.appCode, data: dataObject[encryptionType + 'Secret']}
      this.$http.post(this.apiUrl.common.encryptionData, encryptionParam).then(response => {
        if (response.data.status === 0) {
          dataObject[encryptionType] = response.data.data // 回显数据
          this.encryptionDataHideEye(encryptionType, eyeOwner)
        } else {
          this.$message.error('解密错误：' + response.data.msg)
        }
      })
    } else {
      this.encryptionDataHideEye(encryptionType, eyeOwner)
    }
  },
  /// 页面控制 - 隐藏小眼睛
  encryptionDataHideEye (encryptionType, eyeOwner) {
    if (eyeOwner) {
      this.pageControl.eyes[eyeOwner][encryptionType] = false
    } else {
      this.pageControl.eyes[encryptionType] = false
    }
  },
  /// 审批操作 - 审批结果改变
  handleApprovalTypeChange () {
    // 清空文本框
    this.resetApproveForm()
    // 设置表单验证规则
    if (this.approveData.form.type === this.approveData.decisionType.pass) { // 通过
      // 表单验证
      if (this.pageControl.current.approvalStepContract) {
        console.log('in')
        this.approveData.rules.current = this.approveData.rules.contractPass
      } else {
        this.approveData.rules.current = this.approveData.rules.pass
      }
      // 当前审批接口
      this.apiUrl.approve.current = this.apiUrl.approve.currentObj.pass
      if (this.pageControl.current.approvalStepReview || this.pageControl.current.approvalStepFinal) {
        this.apiUrl.approve.current = this.apiUrl.approve.current + this.pageParams.appCode
      }
    } else if (this.approveData.form.type === this.approveData.decisionType.refuse) { // 拒绝
      // 表单验证
      this.approveData.rules.current = this.approveData.rules.refuse
      // 当前审批接口
      this.apiUrl.approve.current = this.apiUrl.approve.currentObj.refuse
    } else if (this.approveData.form.type === this.approveData.decisionType.cancel) { // 取消
      // 表单验证
      this.approveData.rules.current = this.approveData.rules.cancel
      // 当前审批接口
      this.apiUrl.approve.current = this.apiUrl.approve.cancel + this.pageData.orderBaseInfo.status
    } else if (this.approveData.form.type === this.approveData.decisionType.backToSales) { // 退回经销商
      // 表单验证
      this.approveData.rules.current = this.approveData.rules.backToSales
      // 当前审批接口
      this.apiUrl.approve.current = this.apiUrl.approve.backToSales + this.pageData.orderBaseInfo.status
    } else if (this.approveData.form.type === this.approveData.decisionType.backToPrevious) { // 退回上一个审批步骤
      // 表单验证
      this.approveData.rules.current = this.approveData.rules.backToPrevious
      // 当前审批接口
      this.apiUrl.approve.current = this.apiUrl.approve.currentObj.backToPrevious + this.pageData.orderBaseInfo.status
    }
  }, // ----------------------------------------------------审批结果改变----------------------------------
  /// 审批操作 - 弹出选择原因的对话框
  showCheckApproveReasons (dataType) {
    /// search refs
    if (dataType === 'pass') {
      this.dialogData.chooseReason.data = this.dialogData.chooseReason.passData
    } else if (dataType === 'refuse') {
      this.dialogData.chooseReason.data = this.dialogData.chooseReason.refuseData
    } else if (dataType === 'cancel') {
      this.dialogData.chooseReason.data = this.dialogData.chooseReason.cancelData
    }
    /// show dialog
    this.dialogData.chooseReason.visible = true
  },
  /// 审批操作 - 选择原因
  handleReasonsSelectionChange (selectedReasons) {
    var riskCode = null
    var riskName = null
    selectedReasons.forEach(selectReason => {
      if (riskCode !== null) {
        riskCode = riskCode + ',' + selectReason.riskCode
        riskName = riskName + ',' + selectReason.riskName
      } else {
        riskCode = selectReason.riskCode
        riskName = selectReason.riskName
      }
    })
    this.approveData.form.riskCode = riskCode
    this.approveData.form.riskName = riskName
  },
  /// 审批操作 - 取消选择原因
  cancelCheckApproveReasons () {
    this.$refs.reasonsTable.clearSelection()
    this.dialogData.chooseReason.visible = false
  },
  /// 审批操作 - 重置表单
  resetApproveForm () {
    if (this.$refs.reasonsTable) {
      this.$refs.reasonsTable.clearSelection()
    }
    methodsHelper.reset.approveForm(this.approveData.form)
  },
  /// 审批操作 - 选择退回类型
  handleBackTypeChange (backCode) {
    this.approveData.form.backType = this._enumStore.state['退回经销商类型'][backCode]
  },
  /// 复审/终审操作 - 批复申请还款期限改变 - 费用计算
  handleRLoanPeriodsChange (rLoanPeriods) {
    // 准备参数
    var params = methodsHelper.calculateFee.prepareParams(this.pageParams.appCode, this.pageData)
    // 调用费用计算接口
    this.$http.post(this.apiUrl.common.calculateFee, params).then(response => {
      if (response.data.status === 0) {
        // 设置返回值
        methodsHelper.calculateFee.dealResponse(response.data.data, this.pageData, this.pageHelperData)
      } else {
        this.$message.error('费用计算接口异常，MSG：' + response.data.msg)
      }
    })
  },
  /// 复审/终审操作 - 月供计算
  handleMonthPayClick: function () {
    // 准备参数
    let params = methodsHelper.calculateMonthPay.prepareParams(this.pageData)
    this.$http.post(this.apiUrl.common.calculateMonthPay, params).then(response => {
      if (response.data.status === 0) {
        this.pageHelperData.form.monthPay = response.data.data.repayment
      } else {
        this.$message.error('月供计算异常，MSG：' + response.data.msg)
      }
    })
  },
  /// 保存批复信息
  handleSaveReplyData: function () {
    let params = methodsHelper.saveReplyData.prepareParams(this.pageParams, this.pageData)
    let saveReplyDataUrl = this.apiUrl.base.saveReplyData + this.pageData.orderBaseInfo.status
    this.$http.post(saveReplyDataUrl, params).then(response => {
      if (response.data.status === 0) {
        this.$message.success('已保存')
      } else {
        this.$message.error('保存批复信息失败，MSG：' + response.data.msg)
      }
    })
  },
  /// 审批操作 - 显示指定终审人员对话框
  showPointFinalApproverDialog () {
    this.$http.get(this.apiUrl.base.queryApproverList).then(response => {
      if (response.data.status === 0) {
        this.dialogData.pointFinalApproverDialog.data = response.data.data
        this.dialogData.pointFinalApproverDialog.visible = true
      } else {
        this.$message.warning('获取指定终审审批人列表失败，MSG：' + response.data.msg)
      }
    })
  },
  /// 审批操作 - 选择终审人员
  handleCheckFinalApprover (approver) {
    this.$confirm('确认选择：' + approver.trueName, '提示', {confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'}).then(() => {
      this.approveData.form.nextUserId = approver.userId
      this.approveData.form.nextTrueName = approver.trueName
      this.dialogData.pointFinalApproverDialog.visible = false
      this.approveMainStep()
    }).catch(() => {})
  },
  /// 审批操作 - 提交审批
  submitApproveForm () {
    if (this.pageControl.current.approvalStepGps) {
      this.approveGpsStep()
    } else {
      this.approveMainStep()
    }
  }, // ----------------------------------------------------提交审批----------------------------------
  /// 审批操作 - 主流程审批阶段
  approveMainStep () {
    this.approveData.form.appCode = this.pageParams.appCode
    // form validate
    this.$refs['approveForm'].validate((valid) => {
      if (valid) {
        // 如果是复审的通过和拒绝，需要指定终审审批人员
        if (this.pageControl.current.approvalStepReview && (this.approveData.form.type === this.approveData.decisionType.pass || this.approveData.form.type === this.approveData.decisionType.refuse)) {
          // 如果没有指定审批人，则给出提示，然后直接返回
          if (this.approveData.form.nextUserId === null) {
            // 指定终审人员
            this.showPointFinalApproverDialog()
            return
          }
        }

        // 准备参数
        var approveParam = {}
        // 从form中获取，过滤空值参数
        for (let field in this.approveData.form) {
          if ((this.approveData.form[field] !== null && this.approveData.form[field] !== '') || field === 'remarks') {
            approveParam[field] = this.approveData.form[field]
          }
        }

        // 复审&终审信息块
        if ((this.pageControl.current.approvalStepReview || this.pageControl.current.approvalStepFinal) && this.approveData.form.type === this.approveData.decisionType.pass) {
          approveParam.reApprovalSaveParam = methodsHelper.saveReplyData.prepareParams(this.pageParams, this.pageData)
        }

        // 终审信息块已经做在approveData.form里边了

        console.log(this.apiUrl.approve.current, approveParam)
        // confirm
        this.$confirm('确认提交审批吗?', '提示', {confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'}).then(() => {
          // call api
          this.$http.post(this.apiUrl.approve.current, approveParam).then(response => {
            if (response.data.status === 0) {
              this.$alert(response.data.msg, '提示', {
                confirmButtonText: '确定',
                callback: () => {
                  location.href = this.apiUrl.returnPage.current
                }
              })
            } else {
              this.$message.error(response.data.msg)
            }
          })
        }).catch(() => {})
      } else {
        console.log('not pass validate')
      }
    })
    return false
  },
  /// 审批操作 - GPS审批
  approveGpsStep () {
    if (!this.pageData.carGpsInfoList || this.pageData.carGpsInfoList.length === 0) {
      this.$alert('GPS安装列表为空！', '提示', {confirmButtonText: '确定'})
      return
    }
    // 表单数据阶段
    this.approveData.formGps.appCode = this.pageParams.appCode
    // 1 通过 0 不通过
    this.approveData.formGps.approveSuccess = this.dialogData.chooseGpsStatus.allPass ? 1 : 0
    this.approveData.formGps.gpsData = null // 主要数据
    this.approveData.formGps.originCarGps = null // 主键id
    let notAllGpsNotApproved = false
    // 遍历GPS记录
    this.pageData.carGpsInfoList.forEach(gps => {
      if (!gps.manualAuditCode || gps.manualAuditCode === null) {
        notAllGpsNotApproved = true
        return
      }
      this.approveData.formGps.originCarGps = this.approveData.formGps.originCarGps + ',' + gps.tid
      if (this.approveData.formGps.gpsData === null) {
        this.approveData.formGps.gpsData = this.approveData.formGps.gpsData + '!' + gps.gpsDealer + ',' + gps.gpsInstallWay + ',' + gps.gpsNo + ',' + gps.manualAuditCode + ',' + gps.auditSupplement
      } else {
        this.approveData.formGps.originCarGps = gps.tid
        // gpsData = gps厂商或型号,安装方式code,gpsNo,人工审核结果code,补充内容
        this.approveData.formGps.gpsData = gps.gpsDealer + ',' + gps.gpsInstallWay + ',' + gps.gpsNo + ',' + gps.manualAuditCode + ',' + gps.auditSupplement
      }
    })
    if (notAllGpsNotApproved) {
      this.$alert('请先审核所有的GPS记录', '提示', {confirmButtonText: '确定'})
      return
    }
    // confirm
    this.$confirm('确认提交吗?', '提示', {confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'}).then(() => {
      // call api
      this.$http.post(this.apiUrl.approve.gps, this.approveData.formGps).then(response => {
        if (response.data.status === 0) {
          this.$alert(response.data.msg, '提示', {
            confirmButtonText: '确定',
            callback: () => {
              location.href = this.apiUrl.returnPage.current
            }
          })
        } else {
          this.$message.error(response.data.msg)
        }
      })
    }).catch(() => {})
  },
  /// 订单编辑 - 提交编辑
  submitModifyForm () {
    // 装备参数
    let modifyParam = methodsHelper.modifyOrder.prepareParams(this.pageParams, this.pageData, this.pageHelperData)

    // 暂时不做表单验证
    this.$http.post(this.apiUrl.base.modifyOrderDetail, modifyParam).then(response => {
      if (response.data.status === 0) {
        this.$alert(response.data.msg, '提示', {
          confirmButtonText: '确定',
          callback: () => {
            this.$router.push({'path': this.apiUrl.returnPage.current})
            location.reload()
          }
        })
      } else {
        this.$message.error('保存失败，MSG：' + response.data.msg)
      }
    })
  },
  /// 弹出选择车型的对话框
  showVinInfoDialog () {
    if (this.pageData.orderCarInfo.carIdentifySecret && this.pageData.orderCarInfo.carIdentifySecret !== '') {
      this.dialogData.getC300VinInfo.apiParams.params.vin = this.pageData.orderCarInfo.carIdentifySecret
      this.$http.get(this.apiUrl.common.getC300VinInfo, this.dialogData.getC300VinInfo.apiParams).then(response => {
        if (response.data.status === 0) {
          this.dialogData.getC300VinInfo.visible = true
          this.dialogData.getC300VinInfo.data = response.data.data
        } else {
          this.$message.warning('找不到VIN号相关数据，MSG：' + response.data.msg)
        }
      })
    } else {
      this.$message.error('VIN号缺失')
    }
  },
  /// 订单编辑 - 选择车型
  handleCheckVinInfo (vinInfo) {
    this.pageData.orderCarInfo.vinIdentifyChe300 = vinInfo.modelName
    this.pageData.orderCarInfo.vinIdentifyChe300Id = vinInfo.modelId
    this.dialogData.getC300VinInfo.visible = false
  },
  /// 订单编辑 - 取消选择车型
  cancelCheckVinInfo () {
    this.pageData.orderCarInfo.vinIdentifyChe300 = null
    this.pageData.orderCarInfo.modelId = null
    this.dialogData.getC300VinInfo.visible = false
  },
  /// 订单编辑 - 车辆估价
  showEvaluationPriceDialog () {
    // 设置专属表单验证规则
    this.pageMainForm.rules.current = this.pageMainForm.rules.evaluationPrice
    // 加setTimeout解决修改rules过后立即验证不生效的问题（修改rules过后第一次不生效之后都可以生效）
    window.setTimeout(() => {
      this.$refs['refPageMainForm'].validate((valid) => {
        if (valid) {
          // 准备参数
          methodsHelper.evaluatePrice.prepareParams(this.dialogData, this.pageData, this.pageHelperData, this._enumStore)

          // 调接口
          this.$http.post(this.apiUrl.common.getC300EvaluationPrice, this.dialogData.getC300EvaluationPrice.apiParams).then(response => {
            if (response.data.status === 0) {
              this.dialogData.getC300EvaluationPrice.data = response.data.data
              this.dialogData.getC300EvaluationPrice.visible = true
            } else {
              this.$message.warning('估价失败，MSG：' + response.data.msg)
            }
          })
        } else {
          console.log('valid not passed')
        }
      })
    }, 0)
  },
  /// 订单编辑 - 选择车辆估值
  handleEvaluationPriceSelectionChange (evaluationPrices) {
    let best = (this.pageData.orderCarInfo.aCarCondtion === '优')
    let bad = (this.pageData.orderCarInfo.aCarCondtion === '差')
    evaluationPrices.forEach(ePrice => {
      // 估值单位为（万元）
      let goodPrice = Number(ePrice.goodReference) * 10000
      let normalPrice = Number(ePrice.normalReference) * 10000
      let badPrice = Number(ePrice.badReference) * 10000
      // 1：汽车之家；2：车300
      if (ePrice.assessType === 1) {
        this.pageData.orderCarInfo.carHomePrice = best ? goodPrice : bad ? badPrice : normalPrice
      } else {
        this.pageData.orderCarInfo.aCarPrice = best ? goodPrice : bad ? badPrice : normalPrice
        this.pageData.orderCarInfo.aCarPriceChange = this.pageData.orderCarInfo.aCarPrice
      }
    })
  },
  /// 订单编辑 - 取消车辆估值
  cancelCheckEvaluationPrice () {
    this.$refs.c300EvaluationPriceTable.clearSelection()
    this.dialogData.getC300EvaluationPrice.visible = false
  },
  /// 订单编辑 - 首次上牌时间改修 | 计算车龄
  handleFirstBookDateChange () {
    // 计算车龄
    this.pageData.orderCarInfo.oldCarAge = timeUtil.monthsToNow(this.pageData.orderCarInfo.carFirstBook)
    // 计算二手车价格浮动率
    if (this.pageData.orderCarInfo.oldCarAge >= 0 && this.pageData.orderCarInfo.floatingPro <= 36) {
      this.pageData.orderCarInfo.floatingPro = 20
    } else if (this.pageData.orderCarInfo.oldCarAge >= 37 && this.pageData.orderCarInfo.floatingPro <= 60) {
      this.pageData.orderCarInfo.floatingPro = 10
    } else {
      this.pageData.orderCarInfo.floatingPro = 0
    }
  },
  /// 订单编辑 - 点击编辑按钮
  handleClickModifyButton () {
    this.$router.push({'path': this.apiUrl.modifyPage + this.pageParams.appCode})
    location.reload()
  },
  /// 返回按钮 - 点击返回按钮
  handleClickReturnButton () {
    this.$router.push({'path': this.apiUrl.returnPage.current})
    location.reload()
  },
  /// 审批操作 - 显示GPS人工审核结果（GPS状态）
  showChooseGpsStatusDialog (row) {
    this.dialogData.chooseGpsStatus.currentRow = row
    this.dialogData.chooseGpsStatus.data = gpsStatus
    this.dialogData.chooseGpsStatus.visible = true
  },
  /// 审批操作 - 选择GPS人工审核结果
  handleGpsStatusSelectionChange (selectedArray) {
    let pass = false
    selectedArray.forEach(status => {
      if (status.key === '1') {
        pass = true
        // allPass 用于计算本次GPS审批是否通过，规则是每一条记录均通过才算通过
        this.dialogData.chooseGpsStatus.allPass = pass
        return false
      }
    })
    if (pass && selectedArray.length > 1) {
      this.$alert('选择【审核通过】时不能选择其他选项！', '提示', {confirmButtonText: '确定',
        callback: () => {
          if (this.$refs.chooseGpsStatusTable) {
            this.$refs.chooseGpsStatusTable.clearSelection()
          }
        }})
    } else if (selectedArray.length > 5) {
      this.$alert('每个gps最多选5个！', '提示', {confirmButtonText: '确定'})
    } else {
      this.dialogData.chooseGpsStatus.selectedArray = selectedArray
    }
  },
  /// 审批操作 - 保存选择GPS人工审核结果
  handleGpsStatusSelectionSave () {
    if (this.dialogData.chooseGpsStatus.selectedArray !== null) {
      // 清空原有数据
      this.dialogData.chooseGpsStatus.currentRow.manualAuditResult = null
      this.dialogData.chooseGpsStatus.currentRow.manualAuditCode = null
      // 遍历已选择数据
      this.dialogData.chooseGpsStatus.selectedArray.forEach(gpsStatus => {
        if (this.dialogData.chooseGpsStatus.currentRow.manualAuditResult !== null) {
          this.dialogData.chooseGpsStatus.currentRow.manualAuditResult = this.dialogData.chooseGpsStatus.currentRow.manualAuditResult + ';' + gpsStatus.value
          this.dialogData.chooseGpsStatus.currentRow.manualAuditCode = this.dialogData.chooseGpsStatus.currentRow.manualAuditCode + ';' + gpsStatus.key
        } else {
          this.dialogData.chooseGpsStatus.currentRow.manualAuditResult = gpsStatus.value
          this.dialogData.chooseGpsStatus.currentRow.manualAuditCode = gpsStatus.key
        }
      })
      this.dialogData.chooseGpsStatus.visible = false
      this.$refs.chooseGpsStatusTable.clearSelection()
    }
  },
  /// 弹出附件上传的对话框
  showUploadAttachment () {
    this.dialogData.uploadAttachment.visible = true
  }
}

export {
  orderDetailsMethods
}
